package com.loong.ems.mapper;

import com.loong.ems.domain.entity.EmpAttendanceRecord;
import com.loong.ems.domain.vo.resp.EmpAttendanceRecordVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

/**
 * @author 龙勇-229970722
 * @date 2025-01-03 10:06
 * @description: 打卡考勤接口
 */

@Mapper
public interface EmpAttendanceRecordMapper {
    /**
     * 获取打卡记录
     * @param id
     * @return
     */
    List<EmpAttendanceRecord> getCard(@Param("id") Long id);

    /**
     * 获取打卡记录
     * @param id
     * @param attendanceDate
     * @return
     */
    EmpAttendanceRecord getAttendanceByDate(@Param("id") Long id, @Param("attendanceDate") Date attendanceDate);

    /**
     * 插入打卡记录
     * @param attendanceRecord
     */
    void insert(@Param("attendanceRecord") EmpAttendanceRecord attendanceRecord);

    /**
     * 更新打卡记录
     * @param existingRecord
     */
    void update(@Param("existingRecord") EmpAttendanceRecord existingRecord);

    /**
     * 获取打卡记录列表
     * @return
     */
    List<EmpAttendanceRecordVo> getList();

    /**
     * 获取迟到人数
     * @param attendanceDate
     * @param signInTime
     * @return
     */
    int countByCheckInTime(@Param("attendanceDate") Date attendanceDate, @Param("signInTime") Date signInTime);



    /**
     * 获取打卡记录
     * @param today
     * @return
     */
    Integer countSignIn(@Param("today") LocalDate today);
}
